package com.yutian.selfservice.support;

import com.github.pagehelper.Page;
import com.yutian.selfservice.support.dict.Dict;
import com.yutian.selfservice.support.mapper.UrlServiceMapper;

import com.yutian.selfservice.support.utils.PageSupport;
import com.yutian.selfservice.support.utils.Result;
import com.yutian.selfservice.support.utils.SpringUtil;
import lombok.Data;

import javax.persistence.Table;
import java.util.List;

/**
 * 外部链接式服务
 * 便民服务 一件事
 */
@Data
@Table(name = "t_service_url")
public class UrlService extends ListService {
    private Long type;
    private String name;
    private String url;
    /**
     * 摘要
     */
    private String description;
//    @Override
//    public String getName() {
//        return this.name;
//    }

    @Override
    public Result query() {
        PageSupport.startPage(this);
        Page<UrlService> list = (Page<UrlService>) SpringUtil.getBean(UrlServiceMapper.class).selectList(this);
        return Result.successPage(list);
    }

    @Override
    public List<? extends ListService> selectByIds(List<Long> ids) {
        return SpringUtil.getBean(UrlServiceMapper.class).selectByIds(ids);
    }

    @Override
    public Result details() {
        return Result.success(SpringUtil.getBean(UrlServiceMapper.class).selectByKey(this.getId()));
    }
}
